package com.wnxy.sddfp.search.controller;

import com.wnxy.sddfp.common.model.dto.query.BorrowRecordSearchQuery;
import com.wnxy.sddfp.common.result.Result;
import com.wnxy.sddfp.common.utils.Pages;
import com.wnxy.sddfp.search.entity.BorrowRecordIndexVo;
import com.wnxy.sddfp.search.service.SearchService;
import com.wnxy.sddfp.search.service.impl.HelloServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

@RestController
//@RefreshScope   //动态配置刷新
@RequestMapping("/search")
@Api(tags ="搜索服务")
public class SearchController {

//    @Value("${search.title}")
//    private String title;

    @GetMapping("hello")
    public String hello(){
        return "hello";
    }

    @Autowired
    private HelloServiceImpl helloService;

    @GetMapping("/check")
    public String check(){
        return helloService.handlerBusiness();
    }
    @GetMapping("/check1")
    public String check1(){
        return helloService.handlerBusiness();
    }

    @Autowired
    private SearchService searchService;
    
    @PostMapping("/borrowRecord")
    @ApiOperation("查询借款记录")
    public Result search(@RequestBody BorrowRecordSearchQuery borrowRecordSearchQuery){
        Pages<BorrowRecordIndexVo> pages=
                searchService.search(borrowRecordSearchQuery);
        return Result.ok(pages);
    }
}